﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;

namespace WaveMaster.Holidays.Club.Domain
{
    public class Trip
    {
        public long m_tripID;
        public string m_tripCode;
        public Vessel m_vessel;
        public SeaPort m_seaPort;
        public DateTime m_departureDate;
        public DateTime m_departureTime;
        public DateTime m_cretnDate;
        public DateTime m_modfctnDate;
        public long m_cretnBy;
        public long m_modfctnBy;
        public bool m_avaliable = false;
        public SeaPort m_destinationPortID;
        public DepartureStatus m_departureStatus;


        public Trip() { }
        public Trip(long id) { m_tripID = id; }
        public Trip(MySqlDataReader rd)
        {
            m_tripID = Convert.ToInt64(rd["m_tripID"]);
            m_tripCode = rd["m_tripCode"].ToString();
            m_vessel =new Vessel(Convert.ToInt64(rd["m_vesselID"]));
            m_seaPort = new SeaPort(Convert.ToInt64(rd["m_seaPortID"])); ;
            m_destinationPortID = new SeaPort(Convert.ToInt64(rd["m_destinationPortID"])); 
            m_departureDate = Convert.ToDateTime(rd["m_departureDate"]);
            m_departureTime = Convert.ToDateTime(rd["m_departureTime"]);
            m_avaliable = Convert.ToBoolean(rd["m_avaliable"]);
            m_departureStatus = (DepartureStatus)Enum.Parse(typeof(DepartureStatus), rd["m_departureStatus"].ToString());

            m_cretnDate = Convert.ToDateTime(rd["m_cretnDate"]);
            m_cretnBy = Convert.ToInt64(rd["m_cretnBy"]);
            m_modfctnDate = Convert.ToDateTime(rd["m_modfctnDate"]);
            m_modfctnBy = Convert.ToInt64(rd["m_modfctnBy"]);
        }
        public override string ToString()
        {
            return m_tripCode;
        }
    }
}
